Skip to content

[codex] Port universal applyTo to Cursor alwaysApply#2030

Open
WilliamK112 wants to merge 1 commit into
microsoft:mainfrom
WilliamK112:codex/apm-cursor-always-1744
Open

[codex] Port universal applyTo to Cursor alwaysApply#2030
WilliamK112 wants to merge 1 commit into
microsoft:mainfrom
WilliamK112:codex/apm-cursor-always-1744

Conversation

@WilliamK112

Copy link
Copy Markdown
Contributor

Summary

Closes #1744.

This ports APM's explicit universal instruction intent to Cursor's native always-on rule shape. When a source instruction declares applyTo: "**", Cursor output now emits alwaysApply: true and omits globs:. Scoped patterns still emit globs: as before, including comma-separated lists and YAML sequence inputs.

This follows the maintainer clarification on #1744: do not add a new APM source alwaysApply field; instead faithfully translate the existing universal applyTo: "**" intent into Cursor's documented native form.

What changed

  • Parse Cursor instruction frontmatter through the existing bounded YAML loader.
  • Convert exactly-one universal glob (**, including padded string or one-item YAML sequence) to alwaysApply: true.
  • Preserve existing scoped glob behavior for scalar globs, comma lists, and YAML lists.
  • Guard null/non-mapping frontmatter values so empty applyTo: does not become a literal "None" glob.
  • Document the Cursor transform and add a changelog entry.

Validation

  • uv run --extra dev pytest tests/unit/integration/test_instruction_integrator.py::TestConvertToCursorRules tests/unit/integration/test_instruction_integrator.py::TestCursorRulesIntegration tests/unit/integration/test_instruction_integrator.py::TestApplyToCommaSplitting tests/integration/test_apply_to_comma_e2e.py -q (52 passed)
  • uv run --extra dev pytest tests/unit/integration/test_instruction_integrator.py -q (117 passed)
  • uv run --extra dev ruff check src\apm_cli\integration\instruction_integrator.py tests\unit\integration\test_instruction_integrator.py
  • uv run --extra dev ruff format --check src\apm_cli\integration\instruction_integrator.py tests\unit\integration\test_instruction_integrator.py
  • npm run build --prefix docs
  • git diff --check

Pre-push duplicate check: #1744 is still open, unassigned, and no open PR matched #1744 / alwaysApply / Cursor frontmatter / applyTo terms.

Signed-off-by: Ching Wei Kang <WilliamK112@users.noreply.github.com>
@WilliamK112 WilliamK112 marked this pull request as ready for review July 5, 2026 00:47
Copilot AI review requested due to automatic review settings July 5, 2026 00:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Title: [FEATURE] Support mapping instruction frontmatter to Cursor alwaysApply: true

2 participants